home *** CD-ROM | disk | FTP | other *** search
- package symantec.itools.awt.util;
-
- import java.awt.Component;
- import java.awt.Font;
- import java.awt.FontMetrics;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.Toolkit;
-
- public class Util {
- public static int getFontHeight(Graphics var0) {
- return getFontHeight(var0.getFontMetrics());
- }
-
- public static int getFontHeight(Font var0) {
- return getFontHeight(Toolkit.getDefaultToolkit().getFontMetrics(var0));
- }
-
- public static int getFontHeight(FontMetrics var0) {
- return var0.getHeight();
- }
-
- public static int getStringWidth(Graphics var0, String var1) {
- return getStringWidth(var0.getFontMetrics(), var1);
- }
-
- public static int getStringWidth(Font var0, String var1) {
- return getStringWidth(Toolkit.getDefaultToolkit().getFontMetrics(var0), var1);
- }
-
- public static int getStringWidth(FontMetrics var0, String var1) {
- return var0.stringWidth(var1);
- }
-
- public static Font getDefaultFont() {
- return new Font("Dialog", 12, 0);
- }
-
- public static Graphics getGraphics(Image var0, Component var1) {
- if (var0 == null) {
- return null;
- } else {
- Graphics var2 = var0.getGraphics();
- if (var2 != null && var1 != null && var1.getFont() != null) {
- var2.setFont(var1.getFont());
- }
-
- return var2;
- }
- }
- }
-